# -*- coding: utf-8 -*-

#绘制二维高斯LPF核频谱
from skimage.color import rgb2gray
from skimage.io import imread
from scipy import signal
import numpy as np
import scipy.fftpack as fp
from matplotlib import pylab
im=rgb2gray(imread('lena.jpg'))
gauss_kernel=np.outer(signal.gaussian(im.shape[0],1),signal.gaussian(im.shape[1],1))
freq=fp.fft2(im)
freq_kernel=fp.fft2(fp.ifftshift(gauss_kernel))
pylab.imshow((20*np.log10(0.01+fp.fftshift(freq_kernel))).real.astype(int),cmap='coolwarm')
pylab.colorbar()
pylab.show()
